package com.java.mytools.service.impl;

import com.java.mytools.dao.SysUserDao;
import com.java.mytools.entity.po.SysUserPO;
import com.java.mytools.entity.vo.SysUserVO;
import com.java.mytools.service.SysUserService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * @author wangning
 * @create 2021-09-03 15:42
 */
@Service
public class SysUserServiceImpl implements SysUserService {
	@Autowired
	private SysUserDao sysUserDao;

	@Override
	public List<SysUserVO> findAll() {
		List<SysUserPO> list = sysUserDao.findAll();
		List<SysUserVO> listVO = new ArrayList<>();
		for (SysUserPO sysUser : list) {
			SysUserVO sysUserVO = new SysUserVO();
//			sysUser.setPassword(null);
			BeanUtils.copyProperties(sysUser, sysUserVO);
			listVO.add(sysUserVO);
		}


		return listVO;
	}

	@Override
	public List<SysUserPO> findSysUserList() {
		return sysUserDao.findSysUserList();
	}

}
